<?php

function _ctlCountryList($name, $attribs)
{
	$cacheId = 'WebControl.CountryList.' . $name;
	if (defined('DEPLOY_MODE') && DEPLOY_MODE) {
	    $lifetime = 900;
	} else {
	    $lifetime = 0;
	}
	$rowset = FLEA::getCache($cacheId, $lifetime);
	if (!$rowset) {
		$tableCountry =& FLEA::getSingleton('Model_Country');
		/* @var $tableSysMenu Table_SysMenu */
		$rowset = $tableCountry->findAll(null, 'country_id ASC, country_code ASC');
		FLEA::writeCache($cacheId, $rowset);
	}

	
	$output = "<select name=\"country_id\">\n";
	
	foreach ( $rowset as $key => $item ) {
		$output .= "<option value=\"".$item[country_id]."\">".$item[country_name]."</option>\n";
	}
	
	$output .= "</select>\n";
	return $output;

	
}